




cd ""
global crisis "bankeq30decline"

use "data/crisis.dta",clear

**** merge score
merge 1:1 iso year using "data/f.dta"
drop if _merge == 2 //0
drop _merge

xtset iso_num year
qui gen rcredit_loan = tloans/cpi
qui gen credit_growth = (rcredit_loan - L.rcredit_loan) / L.rcredit_loan * 100

qui tab year, gen(yr)
drop yr1	

qui gen Finance_sentiment_growth = all_stdscore - L.all_stdscore


eststo clear
******  logit regression ******
* col 1
set seed 100
xtset iso_num year
eststo: xtlogit $crisis L.Finance_sentiment_growth, fe vce(boot)

* col 2
set seed 100
xtset iso_num year
eststo: xtlogit $crisis L(1/2).Finance_sentiment_growth, fe vce(boot) 

* col 3
set seed 100
xtset iso_num year
eststo: xtlogit $crisis L(1/2).Finance_sentiment_growth L(1/2).credit_growth if !inlist(country,"China","Russia"), fe vce(boot) 

******  linear probability model ******
* col 4
xtset iso_num year
eststo: xtscc $crisis L(1/2).Finance_sentiment_growth L(1/2).credit_growth if !inlist(country,"China","Russia"), fe

* col 5
eststo: xtscc $crisis L(1/2).Finance_sentiment_growth L(1/2).credit_growth yr* if !inlist(country,"China","Russia"), fe

esttab using "output.csv", star(* 0.10 ** 0.05 *** 0.01) replace se stats(N r2 r2_w r2_a r2_p) drop(yr*)
